<%
if (session.getAttribute("username") == null) {
	%><jsp:forward page="login.jsp" /><%
}
%>
<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.util.*"%>
<%
String newPoll = request.getParameter("newPoll");
if(newPoll != null){
	boolean isNew = newPoll.equals("true");
}

String fail = request.getParameter("fail");
boolean failrecieved = false;
if(fail != null){
	failrecieved = true;
}

String newPollID = (String) request.getParameter("pollid");
String newPollName = (String) request.getParameter("pollname");
String newPollDesc = (String) session.getAttribute("polldesc");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Define Poll</title>
<link rel="stylesheet" href="/DBP/style/stylesheet.css" type="text/css" />
</head>
<body>
<div class="bg">
<div class='content'>
<jsp:include page="/nav.jsp" />
	<div class="pagetitle">Poll Creation -> New Poll</div>
	<div class="entrytitle" style="margin-top:10px;">
	
	<div class="entry">
     <form name="pollmgt" action="insertPoll.jsp" method="post">
		
		<label for="name" style="margin-right:30px;">Name</label>
		<input type="text" name="name" /><br/>
		<label for="description">Description</label>
		<input type="text" name="description" size="50" />
       	<input type="submit" class="button" value="Create!"/>
    </form>
	<%if(failrecieved && fail.equals("true")){%>
      		<div class="error" style="display:inline;"> Error! poll not created :(</div><br/>
    <%}else if(failrecieved && fail.equals("false")){ %>
    		<br/><div class="note" style="display:inline;">Poll created successfully :)</div><br/><br/>
		</div>
	<br/><%} %>
    </div>
    </div>
    </div>
</div>
</body>
</html>
